package com.sky.edumanageapi.chapter.controller;

import com.sky.edumanageapi.base.response.JsonResult;
import com.sky.edumanageapi.chapter.pojo.vo.ChapterVO;
import com.sky.edumanageapi.chapter.service.ChapterService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Slf4j
@Api(tags = "章节模块")
@RestController
@RequestMapping("/chapter")
public class ChapterController {

    @Autowired
    ChapterService chapterService;
    @ApiOperation("章节列表")
    @GetMapping("/select/{courseId}")
    public JsonResult select(@PathVariable Integer courseId) {
        log.debug("查询章节列表:{}", courseId);
        List<ChapterVO> list = chapterService.getChapter(courseId);
        return JsonResult.ok(list);
    }

}
